package com.wenx.v3system.modular.cloud.domain.maps;

import com.wenx.v3core.enums.StatusEnum;
import com.wenx.v3system.modular.cloud.domain.dto.SysTeamDto;
import com.wenx.v3system.modular.cloud.domain.po.SysTeam;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper(componentModel = "spring")
public interface SysTeamMap {

    SysTeamMap INSTANCE = Mappers.getMapper(SysTeamMap.class);

    SysTeam toPo(SysTeamDto dto);
    
    SysTeamDto toDto(SysTeam po);
    
    List<SysTeam> toPoList(List<SysTeamDto> dtoList);
    
    List<SysTeamDto> toDtoList(List<SysTeam> poList);
    
    /**
     * StatusEnum转Integer
     */
    default Integer map(StatusEnum status) {
        return status != null ? status.getValue() : null;
    }
    
    /**
     * Integer转StatusEnum
     */
    default StatusEnum map(Integer status) {
        return StatusEnum.getByValue(status);
    }
}